import VueRouter from 'vue-router'

//导入组件
import home from "./components/tabbar/HomeComponent.vue"
import member from "./components/tabbar/MemberComponent.vue"
import shopcar from "./components/tabbar/ShopCarComponent.vue"
import search from "./components/tabbar/SearchComponent.vue"

//导入主页中的组件
import news  from "./components/home/news/NewsList.vue"
import singlenew  from "./components/home/news/SingleNew.vue"
import photos  from "./components/home/images/PhotoList.vue"
import singlephoto  from "./components/home/images/SinglePhoto.vue"
import goods from "./components/home/goods/GoodsList.vue"
import singlegoods from "./components/home/goods/SingleGoods.vue"
import goodsInfo from "./components/home/goods/GoodsInfo.vue"
import goodscomment from "./components/home/goods/GoodsComment.vue"

// 3. 创建路由对象
var router = new VueRouter({
    routes: [
        {path: '/', redirect: "/home"},
        {path: "/home", component: home},
        {path: "/member", component: member},
        {path: "/shopcar", component: shopcar},
        {path: "/search", component: search},

        {path: "/news", component: news},
        {path: "/home/singleNews/:id", component: singlenew},

        {path: "/photos", component: photos},
        {path: "/home/photo/:id", component: singlephoto},

        {path: "/goods", component: goods},
        {path: "/home/goods/:id", component: singlegoods},
        {path: '/home/goodsInfo/:id', component: goodsInfo, name: "goodsinfo"},
        {path: '/home/goodscomment/:id', component: goodscomment, name: "goodscomment"},
    ],
    linkActiveClass: 'mui-active'
})

// 把路由对象暴露出去
export default router